﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.Entity;

namespace TT.Web.Controllers
{
    public class TournamentController : Controller
    {
        private readonly Logic.Interfaces.ITTContext _dbContext;

        public TournamentController(Logic.Interfaces.ITTContext ttContext)
        {
            _dbContext = ttContext;            
        }

        public ActionResult Index(int id)
        {
            var tournament = 
                _dbContext.Tournaments
                    .Include("Rounds.Matches.HomePlayer1")
                    .Include("Rounds.Matches.AwayPlayer1")
                .FirstOrDefault(x => x.Id == id);
            return View(tournament);
        }

    }
}
